home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / person / bbs_time.zip / TIMECHEK.DOC < prev    next >
Text File  |  1992-05-12  |  11KB  |  274 lines

  1.  
  2.  
  3.  
  4.         
  5.         
  6.         
  7.         
  8.         
  9.         
  10.         
  11.         
  12.                                        TIMECHEK
  13.         
  14.         
  15.                               a SMILEWARE :-) product of
  16.         
  17.         
  18.                                     Steve Antonoff
  19.                                  3917 Garfield Drive
  20.                               Stone Mountain, GA  30083
  21.         
  22.                           1:133/302.0@fidonet, (404) 296-9681
  23.                                   Operates 24 hours
  24.         
  25.                         File Requests & Downloads not available 
  26.                   during FIDOnet Zone Mail Hour (09:00 - 10:00 UCT)
  27.         
  28.         
  29.                                  Updated May 12, 1992
  30.         
  31.              TIMECHEK  is copyright, 1987, 1990, 1992 by  Steve  Antonoff 
  32.         and  is released for public non-commercial use and  distribution.  
  33.         No fees, royalties, licenses are required for non-commercial use.
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.             TIMECHEK  is an outgrowth of TIME96.  TIMECHEK  can  function 
  41.         just  like TIME96 (it has all of TIME96's capabilities) plus  one 
  42.         additional  feature that makes it much easier to  use.   TIMECHEK 
  43.         checks  the system clock for the time of day, day of  week,  etc, 
  44.         and exits with an ERRORLEVEL based on that time and the arguments 
  45.         presented with the command.  For version 2.0, there is no default 
  46.         mode.   Version 2.1 adds the "hour of day" and "minute  of  hour" 
  47.         capabilities.
  48.         
  49.             The  original  mode of TIME96, and the old  default  mode  of 
  50.         TIMECHEK, can be accessed by use of a /T command line  parameter.  
  51.         In  this mode, the 24 hour day is broken into 96  fifteen  minute 
  52.         intervals.   Thus, between midnight (00:00:00) and  quarter  past 
  53.         (00:14:59),  timechek returns an errorlevel of 1; at 6:00:00  AM, 
  54.         it returns an errorlevel of 25, at noon an errorlevel of 49, etc.  
  55.         
  56.             Through  use of this program, a batch file can  do  different 
  57.         things based on time of day, day of week, etc.  It was written to 
  58.         allow different parameters to be passed to a FIDOnet mail proces-
  59.         sor based on the time. 
  60.         
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.             The  current version of TIMECHEK has several arguments  which 
  68.         affect the program's behaviour: 
  69.         
  70.         Q:  any  argument  beginning  with a -Q  (quite)  suppresses  the 
  71.             generation of the copyright and time of day printout; 
  72.         
  73.         W:  any argument beginning with a -W causes TIMECHEK to return an 
  74.             argument based on the DAY OF WEEK in place of the TIME OF DAY 
  75.             (1=Sunday, 2=Monday, etc.);
  76.         
  77.         M:  any  argument beginning with a -M causes timechek  to  return 
  78.             the MONTH (Jan = 1, etc);
  79.         
  80.         D:  any  argument beginning with a -D causes TIMECHEK  to  return 
  81.             the day of the month (ie, 9/22/87 -> 22);
  82.         
  83.         Y:  any  argument beginning with a -Y causes TIMECHEK  to  return 
  84.             the year (2 digit).
  85.         
  86.         H:  any  argument beginning with a -H causes TIMECHEK  to  return 
  87.             the hour of the day (0-23).
  88.         
  89.         ::  any  argument beginning with a colon (/:) causes TIMECHEK  to 
  90.             return the minute within the hour (0-59).
  91.         
  92.         R:  any argument beginning with a -R puts TIMECHEK into the RANGE 
  93.             mode.   The  program will scan the  remaining  arguments  and 
  94.             return the number of the FIRST range that matches the current 
  95.             time.   Ranges are of the form 
  96.         
  97.         DD#DD#DD:ssss-eeee/l 
  98.         
  99.         where:
  100.         
  101.         DD  is  a  day of the week (enought character  to  make  it 
  102.             unique  in English: SU, M, TU, W, TH, F, SA), WK  (weekdays), 
  103.             WN (weekends) or A (all days).  Multiple days may be  "or-ed" 
  104.             together  with  #, thus M#WMF means Monday  or  Wednesday  or 
  105.             Friday.  More letters than the minimum can be used, so FRIDAY 
  106.             is the same thing as F.
  107.         
  108.         ssss  is  the  start time (expressed as a number  between  0  and 
  109.             2400).  If no start time is specified, 0000 is assumed.
  110.         
  111.         eeee is the end time (expressed as a number between 0 and  2400).  
  112.             If  no  end time is specified, 2400 is assumed.
  113.         
  114.         l is the errorlevel to return if this range is the match.  If  no 
  115.             level  is specified, the ordinal number of the  range  within 
  116.             the command line is used.
  117.         
  118.             With  version 2.0, the structure of the range  parameters  is 
  119.         much more flexible: the number of letters in the day of the  week 
  120.         parameter is flexible, the numbers of digits in the start and end 
  121.         time is flexible, and the user can specify an errorlevel with the 
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.         range.
  129.         
  130.             The T, M, D, W, Y, H, : and R options are mutually exclusive, 
  131.         and only the LAST one entered will be in effect.  These arguments 
  132.         can  be  upper or lower case and must be preceded by a - or  a  / 
  133.         [this is a change from TIME96, where the - and / were  optional].  
  134.         All of the following are legal:
  135.         
  136.         timechek 
  137.              The above example displays an on-line help message.
  138.         TIMECHEK /W
  139.         TIMECHEK /Q /m
  140.         TIMECHEK /Q /d
  141.         TIMECHEK /w -q
  142.         timechek -t
  143.         timechek  -r al:0400-0500 al:2300-2400 al:0000-0700  ....
  144.             .... sa:0000-2400 su:0000-1700
  145.              (The  last  sample is too long to fit on one  line  in  this 
  146.              document, but the sa: and the su: go on the same line as the 
  147.              other  arguments.  This basically says: if the current  time 
  148.              is  between 0400 and 0500, return errorlevel 1, if the  time 
  149.              is  between 2300 and 2400 return 2, if the time  is  between 
  150.              midnight and 7am return 3, if it is Saturday (and not one of 
  151.              the  preceeding times) return 4 and if it is Sunday  (again, 
  152.              not  one of the preceeding times) return 5.  Thus, with  one 
  153.              command, a BAT file can detect National Mail Hour (errorlev-
  154.              el 1) and cheap long distance rates in the US (return levels 
  155.              2-5).  A errorlevel of 0 indicates higher than minimum  long 
  156.              distance rates and not NMH.  
  157.         
  158.         timechek -r A:400-500 a:2300 a:-700 sa su:-1700 
  159.              This  example  has the same effect as the previous  one  but 
  160.              uses  a more compact format.
  161.         
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.                          Example Table of return values
  169.         
  170.                       Day   Time       -T   -H   -W option
  171.                       Sun    00:00      1    0      1
  172.                       Sun    06:00     25    6      1
  173.                       Sun    12:00     49   12      1
  174.                       Sun    18:00     73   18      1
  175.                       Sun    23:45     96   23      1
  176.         
  177.                       Mon    00:00      1           2
  178.                       Mon    06:00     25           2
  179.                       Mon    12:00     49           2
  180.                       Mon    18:00     73           2
  181.         
  182.                       Tue    00:00      1           3
  183.                       Wed    00:00      1           4
  184.                       Thu    00:00      1           5
  185.                       Fri    00:00      1           6
  186.                       Sat    00:00      1           7
  187.                       Sat    23:45     96           7
  188.         
  189.         
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.         Sample use - timechek compatible runs:
  197.                  timechek -w
  198.                  if errorlevel 7 goto   SATURDAY
  199.                  if errorlevel 6 goto   FRIDAY
  200.                  if errorlevel 5 goto   THURSDAY
  201.                  if errorlevel 4 goto   WEDNESDAY
  202.                  if errorlevel 3 goto   TUESDAY
  203.                  if errorlevel 2 goto   MONDAY
  204.         
  205.                  :SUNDAY
  206.                  rem Sunday is cheap until 5PM (69)
  207.                  timechek -t
  208.                  if errorlevel 69 goto OMMMHOLD
  209.                  goto OMMMSEND
  210.         
  211.                  :MONDAY
  212.                  :TUESDAY
  213.                  :WEDNESDAY
  214.                  :THURSDAY
  215.                  :FRIDAY
  216.                  rem 93 is 23:00, 29 is 07:00 - between 7am & 
  217.                  rem 11 PM HOLD all long distance
  218.                  rem before 7 and after 11 don't hold
  219.                  timechek -t
  220.                  if errorlevel 93 goto OMMMSEND
  221.                  if errorlevel 29 goto OMMMHOLD
  222.                  goto OMMMSEND
  223.         
  224.                  :SATURDAY
  225.                  rem Saturday is ALWAYS cheap, so send stuff
  226.                  goto OMMMSEND
  227.         
  228.         Sample run - RANGE option:
  229.               
  230.                  timechek -r a:400-500 sa su:-1700 al:2300 al:-0700
  231.                  if errorlevel 2 goto CHEAPMAIL
  232.                  if errorlevel 1 goto ZMH
  233.                  goto OMMMHOLD
  234.         
  235.         
  236.         Notes and caveats:
  237.         
  238.         1)  This  program  was compiled with Turbo C version  2.0.   Time 
  239.             zones are not supported: the program reports and operates  on 
  240.             the time as returned by the DOS clock.
  241.         
  242.         2)  The  Y,  H, : and R options are the only  options  which  can 
  243.             return an errorlevel of 0 (zero).  All others return a  mini-
  244.             mum of a 1.  No check is made to verify that the clock/calen-
  245.             dar  make  sense:  whatever DOS reports, that's what  is  re-
  246.             turned.
  247.         
  248.         3)  This  program has been tested with PC-DOS 3.20,  MS-DOS  3.21  
  249.             MS-DOS  3.30 and MS-DOS 5.00.  Other versions of  DOS  should 
  250.             work fine, but they have not been tested.
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.         
  258.         4)  The  August  4, 1988, version corrects an oversight:  WE  was 
  259.             used for both WEdnesday and WEekends.  The code for  WeekeNds 
  260.             was changed to WN.
  261.         
  262.         5)  By  error,  the wrong doc file was included in  the  January, 
  263.             1988  release.  The file was a WordStar document file.   This 
  264.             version  includes the correct plain text file, formatted  for 
  265.             8.5 x 11 inch paper, with form feeds, etc.
  266.         
  267.         6)  The  license for version 2.0 and higher has been  changed  to 
  268.             permit  free  use only in NON-COMMERCIAL  environments.   For 
  269.             commercial  use, contact the author, Steve Antonoff,  at  the 
  270.             address listed above.
  271.         
  272.         7)  Timechek is now included in the BBS_TIME utilities  distribu-
  273.             tion set (BBS_TIME.ZIP).
  274.